<template>
  <div class="device-details">
    <h2></h2>
    <div class="tab-class">
      <div
        :class="[
          title.classs,
          {
            active: activeIndex === index && activeIndex !== 1,
            special: activeIndex === index && activeIndex === 1
          }
        ]"
        v-for="(title, index) in titles"
        :key="index"
        @click="tabControl(index)"
      >
        {{ title.name }}
      </div>
    </div>
    <div class="box" v-show="activeIndex === 0">
      <div class="onLineType">
        <span>在线状态</span>
        <div class="onLine">在线</div>
      </div>
      <div class="number">
        <span>实时数值</span>
        <div class="temperature"><sapn style="color: #fff">温度</sapn>&nbsp;&nbsp;<sapn style="color: #fff">25.6</sapn></div>
      </div>
    </div>
    <div class="box" v-show="activeIndex === 1">
      <div class="contentList">
        <span class="name">名称：</span>
        <span class="content">高密API</span>
      </div>
      <div class="contentList">
        <span class="name">名称：</span>
        <span class="content">高密API</span>
      </div>
      <div class="contentList">
        <span class="name">名称：</span>
        <span class="content">高密API</span>
      </div>
      <div class="contentList">
        <span class="name">名称：</span>
        <span class="content">高密API</span>
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from "vue";
const titles = [
  { name: "动态属性", classs: "box1" },
  { name: "基本信息", classs: "box2" }
];
const activeIndex = ref(0);
const tabControl = (index: number) => {
  activeIndex.value = index;
};
</script>

<style scoped lang="less">
.device-details {
  width: 580px;
  height: 370px;
  overflow: hidden;
  opacity: 1;
  background-image: url(../../assets/img/lightUp/ocPopupBck.png);
  background-repeat: no-repeat;
  box-sizing: border-box;
  padding: 0 20px;
  h2 {
    margin: 18px 0 0 14px;
    font-size: 18px;
    box-sizing: border-box;
    padding: 16px 0 0 64px;
    position: relative;
    .close {
      height: 27px;
      width: 27px;
      position: absolute;
      top: 11px;
      right: 27px;
      cursor: pointer;
    }
  }
}
.tab-class {
  display: flex;
  margin: 30px 0 20px 0;
  div {
    width: 80px;
    line-height: 26px;
    text-align: center;
    background-size: 80px 26px;
    font-size: 14px;
    cursor: pointer;
  }
  .box1 {
    background-image: url(../../assets/img/lightUp/managementGeneralNocheckOne.png);
  }
  .box2 {
    background-image: url(../../assets/img/lightUp/managementGeneralNocheckTwo.png);
  }
  .box3 {
    background-image: url(../../assets/img/lightUp/managementGeneralNocheckOne.png);
  }
  .active {
    font-weight: bold;
    color: #ffbe21;
    background-image: url(../../assets/img/lightUp/managementGeneralCheckOne.png);
  }
  .special {
    font-weight: bold;
    color: #ffbe21;
    background-image: url(../../assets/img/lightUp/managementGeneralCheckTwo.png);
  }
}
.onLineType,
.number {
  width: 234px;
  display: flex;
  align-items: center;
  text-align: center;
  line-height: 40px;
  width: 100%;
  display: flex;
  justify-content: center;
  span {
    width: 56px;
    font-size: 14px;
    font-family: Source Han Sans CN-Regular, Source Han Sans CN;
    font-weight: 400;
    color: #ffffff;
    margin-right: 10px;
  }
  .onLine,
  .temperature {
    width: 164px;
    height: 40px;
    border-radius: 4px 4px 4px 4px;
    opacity: 1;
    background-image: url(../../assets/img/lightUp/valueBck.png);
  }
}
.onLineType {
  margin-bottom: 20px;
  margin-top: 60px;
  color: #5affff;
}

.current() {
  font-size: 14px;
  font-family: Microsoft YaHei-Regular, Microsoft YaHei;
  font-weight: 400;
}
.contentList {
  margin-bottom: 20px;
  .name {
    .current();
    color: #bee2ff;
    margin-right: 10px;
  }
  .content {
    .current();
    color: #ffffff;
  }
}
</style>
